//
//  NSAttributedString+text.m
//  ISmart
//
//  Created by 郑信鸿 on 17/4/28.
//  Copyright © 2017年 郑信鸿. All rights reserved.
//

#import "NSAttributedString+text.h"

@implementation NSAttributedString (text)

@end

@implementation NSMutableAttributedString (text)

- (void)setColor:(UIColor *)color inRange:(NSRange)range{
    
    //    NSDictionary *attriDict = @{
    //                                NSForegroundColorAttributeName:color
    //                                };
    //[self setAttributes:attriDict range:range];
    [self addAttribute:NSForegroundColorAttributeName value:color range:range];
}


- (void)setFont:(UIFont *)font inRange:(NSRange)range{
    //    NSDictionary *attriDict = @{
    //                                NSFontAttributeName:font
    //                                };
    [self addAttribute:NSFontAttributeName value:font range:range];
    // [self setAttributes:attriDict range:range];
}


- (void)setLineSpacing:(CGFloat)lineSpacing{
    
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:lineSpacing];
    [self addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, self.string.length)];
}

@end
